#ifndef OMG_TDDS_CORE_STATUS_CONDITION_HPP_
#define OMG_TDDS_CORE_STATUS_CONDITION_HPP_

/* Copyright 2010, Object Management Group, Inc.
 * Copyright 2010, PrismTech, Inc.
 * Copyright 2010, Real-Time Innovations, Inc.
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


namespace tdds { namespace core {


/**
 * A StatusCondition object is a specific Condition that is
 * associated with each Entity.
 * The trigger_value of the StatusCondition depends on the communication
 * status of that entity (e.g., arrival of data, loss of information, etc.),
 * filtered by the set of enabled_statuses on the StatusCondition.
 * The enabled_statuses and its relation to Listener and WaitSet is detailed
 * in Trigger State of the StatusCondition.
 */
template <typename DELEGATE>
class StatusConditionBase : public Condition<DELEGATE> {
    OMG_DDS_REFERENCE_TYPE(StatusConditionBase)

public:
    /**
     * This operation defines the list of communication statuses that
     * are taken into account to determine the trigger_value of the
     * StatusCondition. This operation may change the trigger_value of
     * the StatusCondition.
     * WaitSet objects behavior depend on the changes of the trigger_value
     * of their attached conditions. Therefore, any WaitSet to which the
     * StatusCondition is attached is potentially affected by this operation.
     * If this function is not invoked, the default list of enabled statuses
     * includes all the statuses.
     *
     * @param status the enabled statuses
     */
    void enabled_statuses(const dds::core::status::StatusMask& status);

    /**
     * This operation retrieves the list of communication statuses that are
     * taken into account to determine the trigger_value of the
     * StatusCondition. This operation returns the statuses that were
     * explicitly set on the last call to enabled_statuses or, if
     * enabled_statuses was never called, the default list
     * (see Section 7.1.2.1.9.1).
     */
    const dds::core::status::StatusMask enabled_statuses();
};
} }


namespace dds { namespace core {

/**
 * A StatusCondition object is a specific Condition that is
 * associated with each Entity.
 * The trigger_value of the StatusCondition depends on the communication
 * status of that entity (e.g., arrival of data, loss of information, etc.),
 * filtered by the set of enabled_statuses on the StatusCondition.
 * The enabled_statuses and its relation to Listener and WaitSet is detailed
 * in Trigger State of the StatusCondition.
 */
template <typename ENTITY>
class StatusCondition : public StatusConditionBase
{
    OMG_DDS_REFERENCE_TYPE(StatusCondition)

public:
    /**
     * This operation returns the Entity associated with the StatusCondition.
     * Note that there is exactly one Entity associated with each
     * StatusCondition.
     */
    ENTITY parent();
};
} }

#endif /* OMG_TDDS_CORE_STATUS_CONDITION_HPP_ */
